﻿<!DOCTYPE html>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <meta name="robots" content="all">
    <meta name="renderer" content="webkit|ie-stand|ie-comp">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta http-equiv="x-dns-prefetch-control" content="on">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>在线全真模拟考场</title>
    <!--<link href="css/bootstrap.css" rel="stylesheet" type="text/css"/>-->
    <link href="/ViewV5/CSS/saved_resource.css" rel="stylesheet" type="text/css">
    <link href="/ViewV5/CSS/saved_resource(2).css" rel="stylesheet" type="text/css">
    <link href="/ViewV5/CSS/zj.css" rel="stylesheet" type="text/css">

</head>
<body>
    <style>
        .content {
            width: 1020px;
            margin: 0 auto;
            font-family: "Microsoft YaHei", "SimSun", "u5b8bu4f5353";
            padding-bottom: 30px;
            margin-top: 20px;
            min-height: 600px;
        }

        .rightArea-tool .bd, .rightArea-tool .hd, .rightArea-tool .ft {
            overflow: hidden;
        }

        .main-nav:after, .screening dl:after, .xxm-poptip-cont:after, .content:after, .exam-report-cont-blk .biaoti-hd:after, .exam-report-cont-blk .number-bd:after, .np-post-header:after {
            display: block;
            visibility: hidden;
            clear: both;
            height: 0;
            content: '.';
        }

        .rightArea-answer dt {
            line-height: 15px;
        }

        .bd .suspend i {
            display: block;
            width: 16px;
            height: 16px;
            margin: 16px 10px 0 15px;
            background: url(images/tk_exam_new.png) -213px -117px;
            float: left;
        }

        .rightArea-tool .bd .btn.jx i {
            background-position: -282px -274px;
        }

        .btn-ks {
            padding: 4px 15px;
            background: #f06000;
            border: none;
            border: 1px solid #d95700;
            color: #fff;
            border-radius: 2px;
            cursor: pointer;
        }
    </style>
    <script src="/ViewV5/JS/jquery-1.11.2.min.js"></script>
    <script src="/ViewV5/JS/avalon1.47.js?ver=1"></script>
    <script src="/ViewV5/JS/toastr.js"></script>
    <script src="/ViewV5/CSS/bootstrap3.3.5/js/bootstrap.js"></script>
    <script src="/ViewV5/JS/SZHLCommon.js"></script>
    <script>
        var model = avalon.define({
            $id: "KSPAGE",
            SJModelInfo: {},
            surplusTime: 0,
            YZTCount: 0,
            ksapsc: 0,
            ksapId: ComFunJS.getQueryString("ksapid", 4),
            ksType: ComFunJS.getQueryString("ksType", 0),
            UserKSInfo: { "KSAPID": ComFunJS.getQueryString("ksapid", 4), "KSType": ComFunJS.getQueryString("ksType", 0) },
            numberData: ["一", "二", "三", "四", "五", "六", "七", "八"],
            GetKSPAGE: function () {
                $.getJSON('/API/VIEWAPI.ashx?Action=KSGL_GETSJGLMODELVIEW', { P1: ComFunJS.getQueryString("sjid", ""), P2: model.ksapId }, function (result) {
                    if (result.ErrorMsg == "") {
                        var i = 1;
                        result.Result[0].TXType.forEach(function (item) {
                            item.STList.forEach(function (el) {
                                el.Order = i;
                                i++;
                                if (el.ksCount > 0) {
                                    model.YZTCount++;
                                }
                            })
                        })
                        model.SJModelInfo = result.Result[0];
                        model.ksapsc = result.Result3;
                        if (result.Result1) {
                            model.UserKSInfo = result.Result1;
                        }
                        if (result.Result2) {
                            model.surplusTime = result.Result2;
                        }
                        else {
                            model.surplusTime = model.SJModelInfo.KSSC * 60;
                        }
                        doSubmit();
                    }
                    else {
                        top.ComFunJS.winAlert2(result.ErrorMsg, function () {
                            model.refiframe();
                            top.layer.closeAll();
                        });
                    }
                })
            }, ADDKS: function (QItem, STItem) {
                var UserKSItem = { "SJID": model.SJModelInfo.ID, "Answer": QItem.ItemName, "STID": QItem.STID };
                if (QItem.isselect && STItem.STType == "多选题") {
                    $.getJSON("/API/VIEWAPI.ashx?ACTION=KSGL_DELKSITEM", { P1: JSON.stringify(UserKSItem) }, function () {
                        QItem.isselect = "";
                    })
                    return;
                }
                $.post("/API/VIEWAPI.ashx?ACTION=KSGL_ADDUSERKS", { P1: JSON.stringify(model.UserKSInfo.$model), P2: JSON.stringify(UserKSItem), stType: STItem.STType }, function (result) {
                    result = JSON.parse(result);
                    if (result.ErrorMsg == "") {
                        if (STItem.STType == "单选题") {
                            STItem.QItem.forEach(function (item) {
                                item.isselect = "";
                            })
                        }
                        QItem.isselect = result.Result1.ID;
                        STItem.ksCount = 1;
                        model.UserKSInfo = result.Result;
                        if (result.Result2 == 0) {
                            model.YZTCount++;
                        }
                    }
                });
            }, refiframe: function () {

                var piframe = $("iframe", top.frames["main"].document)[0];
                if (piframe && piframe.contentWindow.location.href && piframe.contentWindow.location.href !== "about:blank") {
                    piframe.contentWindow.location.reload()
                } else {
                    if (top.frames["main"].location.href !== "about:blank") {
                        top.frames["main"].location.reload();
                    }
                }
            }, SubmitKS: function () {
                top.ComFunJS.winconfirm("确定要交卷吗？", function () {
                    model.SubmitKSnew();
                })
            }, SubmitKSnew: function () {
                $.post("/API/VIEWAPI.ashx?ACTION=KSGL_SUBMITSJ", { P1: model.UserKSInfo.ID }, function (result) {
                    result = JSON.parse(result)
                    if (result.ErrorMsg == "") {
                        model.UserKSInfo = result.Result;
                        top.ComFunJS.winAlert2("交卷成功", function () {
                            model.refiframe();
                            top.layer.closeAll();
                        });
                    }
                });
            }, DelKS: function (sjID, stID) {
                $.getJSON("/API/VIEWAPI.ashx?ACTION=KSGL_DELKSITEM", { P1: sjID, P2: stID }, function () {

                })
            },
            Completion: function (STItem) {
                var UserKSItem = { "SJID": model.SJModelInfo.ID, "Answer": STItem.Answer, "STID": STItem.STID };
                $.post("/API/VIEWAPI.ashx?ACTION=KSGL_ADDUSERKS", { P1: JSON.stringify(model.UserKSInfo.$model), P2: JSON.stringify(UserKSItem), stType: STItem.STType }, function (result) {
                    result = JSON.parse(result);
                    if (result.ErrorMsg == "") {
                        STItem.ksCount = 1;
                        model.UserKSInfo = result.Result;
                        if (result.Result2 == 0) {
                            model.YZTCount++;
                        }
                    }
                });
            }
        })
        avalon.ready(function () {
            model.GetKSPAGE();
        })
    </script>
    <div>
        <div class="container bg-default" style="min-width:1000px;" ms-controller="KSPAGE">
            <div class="content ">
                <!-- 内容 部分 -->
                <div class="exam-report  page_container" style="position:relative">
                    <div class="m-examHead f-bg ">
                        <!--试卷头信息-->
                        <h1 class="h1"> {{SJModelInfo.SJName}} </h1>
                        <div class="info">
                            <p>◇ 本卷共分为 {{SJModelInfo.DTCount}}大题 {{SJModelInfo.XTCount}}小题，作答时间为 {{ksapsc}}分钟，总分 {{SJModelInfo.TotalRecord}} 分，{{SJModelInfo.PassRecord}} 分及格。</p>
                            <div class="attention">
                                {{SJModelInfo.SJDescribe|html}}
                            </div>

                        </div>
                    </div>
                    <!-- 试题部分 -->
                    <div class="exam-report-cont-blk f-f14" id="page-body" oncontextmenu="document.all?(window.event.returnValue=false):(event.preventDefault())" oncopy="return false" oncut="return false">
                        <div id="page-rules-1701454" ms-repeat-item="SJModelInfo.TXType">
                            <div class="m-secpart" id="page-rules-head-1701454">
                                {{numberData[$index]}}、{{item.STType}}(共{{item.totalCount}}题<lable ms-if="item.STType=='单选题'">，每题1分。每题的备选项中，只有一个最符合题意</lable>)
                            </div>
                            <div>
                                <div class="m-question question-item " ms-repeat-el="item.STList" ms-attr-id="question-{{el.Order}}">
                                    <div class="m-question-title">
                                        <span class="number">{{el.Order}}<i></i></span>
                                        <div class="f-title">
                                            {{el.QContent|html}}
                                        </div>
                                    </div>
                                    <div class="m-question-list-html" ms-if="item.STType!='单选题'&&item.STType!='多选题'&&item.STType!='判断题'">
                                        <div class="m-choicebox">
                                            <textarea style="height: 50px; width: 654px; max-width: 654px;" ms-duplex="el.Answer" ms-blur="Completion(el)"></textarea>
                                        </div>
                                    </div>
                                    <div class="m-question-list-html" ms-if="item.STType=='单选题'||item.STType=='多选题'||item.STType=='判断题'">
                                        <div class="m-choicebox">
                                            <ul class="single">
                                                <li class="question-option-list" ms-repeat-qitem="el.QItem" ms-attr-value="qitem.ItemName"><span>{{qitem.ItemName|html}}</span><div class="option-content">{{qitem.ItemDesc|html}}</div></li>
                                            </ul>
                                        </div>
                                    </div>
                                    <div class="m-question-html " style="min-height:67px;" ms-if="el.QItem.size()>0">
                                        <div class=" m-questiontoolbar">
                                            <div class="m-checkBox single">
                                                <a class="question-option-list " ms-repeat-qaitem="el.QItem" ms-class-1="u-selected:qaitem.isselect" href="javascript:void(0)" ms-attr-value="qaitem.ItemName" ms-click="ADDKS(qaitem,el)">{{qaitem.ItemName}}</a>
                                            </div>
                                        </div>
                                    </div>
                                    <div class="answer clearfix question-answer-bar" style="margin-top: 0px;display:none">
                                        <div class="answer-tool" style="padding: 15px 0px 15px 0px;">
                                            <div class="f-fl"><span class="txt">参考答案：</span><span class="option right" ms-if="item.QAnswer==''">暂未提供参考答案</span><span class="txt f-dn page-shuffle-answer" ms-if="item.QAnswer==''">我的答案：</span><span class="option right" ms-if="item.QAnswer!=''" ms-html="item.QAnswer"></span></div>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                    <!-- 试题部分 END -->
                    <!-- 答题右侧操作 -->
                    <div class="exam-rightArea" id="page-right-frame" style="float:none;margin-left:750px">
                        <!--功能操作区域-->
                        <div class="rightArea-tool">
                            <div class="hd">
                                <div class="time">
                                    <i id="page-timer-icon" style="transform: rotate(200deg);"></i>
                                    <span>
                                        剩余时间
                                        <strong id="hid">
                                        </strong>
                                    </span>
                                </div>
                            </div>
                            <div class="bd" ms-if="!ksapId">
                                <a href="###" class="btn suspend page-back" onclick="doPause()" id="tid" isabled><i></i><span>暂停考试</span></a>
                                <a href="###" class="btn jx" onclick="doGo()" id="gid"><i></i><span>继续考试</span></a>
                            </div>
                        </div>
                        <!--答题卡区域-->
                        <div class="rightArea-answer">
                            <div class="hd">
                                <span class="title">答题卡 <span class="card-count" id="page-card-info" style="font-size: 12px;color: #F06000;margin-left: 10px">{{YZTCount}} / {{SJModelInfo.XTCount}}</span></span>
                            </div>
                            <div class="bd" id="page_card" style="height: 350px;">
                                <dl class="panel-item" data-rulesid="1701454" ms-repeat-item="SJModelInfo.TXType">
                                    <dt>{{item.STType}}<span style="font-weight: normal; margin-left: 5px">每题1分 共{{item.totalCount}}题</span></dt>
                                    <dd class="panel-order">
                                        <a ms-href="#question-{{el.Order}}" class="page-card-item " ms-repeat-el="item.STList" ms-class-1="active:el.ksCount>0">{{el.Order}}</a>
                                    </dd>
                                </dl>
                            </div>
                            <div class="ft">
                                <div class="btn-1" id="page-btn-next" ms-if="!ksapId">保存进度，下次继续</div>
                                <div class="btn-2" id="page-btn-submit" ms-click="SubmitKS()">交卷</div>
                            </div>
                        </div>
                    </div>
                    <!-- // END -->
                    <div class="clearfix"></div>
                </div>
            </div>
        </div>
    </div>
    <script type="text/javascript">
        $.fn.smartFloat = function () {
            var position = function (element) {
                var top = element.position().top, pos = element.css("position");
                $(window).scroll(function () {
                    var scrolls = $(this).scrollTop();
                    if (scrolls > top) {
                        if (window.XMLHttpRequest) { //如果不是ie6
                            element.css({
                                position: "fixed",
                                top: 0
                                //left:50
                            });
                        } else { //如果是ie6
                            element.css({
                                top: scrolls
                            });
                        }
                    } else {
                        element.css({
                            position: pos,
                            top: top
                        });
                    }
                });
            };
            return $(this).each(function () {
                position($(this));
            });
        };
        $(function () {
            $("#page-right-frame").smartFloat();

        });

    </script>
    <script type="text/javascript">
        var h = 0, m = 0, s = 0;
        var mytime = null;
        //开始倒计时
        function doSubmit() {
            m = parseInt(model.surplusTime / 60);
            s = parseInt(model.surplusTime % 60);

            if (m > 60) {
                h = parseInt(m / 60);
                m = parseInt(m % 60);
            }
            run();
            return false;
        }
        //执行倒计时
        function run() {
            //输出
            var hid = document.getElementById("hid");
            hid.innerHTML = (h < 10 ? "0" + h : h) + ":" + (m < 10 ? "0" + m : m) + ":" + (s < 10 ? "0" + s : s);
            s--;
            if (s < 0) {
                s = 59;
                m--;
                if (m < 0) {
                    m = 59;
                    h--;
                    if (h < 0) {
                        alert('时间到！');
                        model.SubmitKSnew();
                        return;
                    }
                }
            }
            mytime = setTimeout("run()", 1000);
        }

        //暂停
        function doPause() {
            if (mytime != null) {
                clearTimeout(mytime);
                mytime = null;
            }
            document.getElementById("tid").disabled = true
            document.getElementById("gid").disabled = false;
        }

        //继续
        function doGo() {
            run();
            document.getElementById("tid").disabled = false;
            document.getElementById("gid").disabled = true;
        }
    </script>
</body>
</html>